<%-- 
    Document   : editProduct
    Created on : Apr 29, 2013, 10:37:18 PM
    Author     : Gleb
--%>

<%@page import="com.charlie.beans.Product"%>

<%@include file="/header.jsp" %>

<% Product editProduct = (Product) request.getAttribute("product");
    if (editProduct != null) {
%>

<div class="left_side">
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />
</div>

<div class="right_side"> 
    <h2 class="content_title">Edit products</h2>
    <div class="white_block" >
        <table align="center" border="0">
            <tr>
                <td>
                    <form action = "editProductServlet" method="post" >
                        <input type ="hidden" name="id" value="<%=editProduct.getProductId()%>">
                        Name:&nbsp&nbsp
                        <input type ="text" name ="productName" style="width: 100%" value="<%=editProduct.getName()%>"> <p>
                        Cost:
                        &nbsp&nbsp<input type ="text" name ="cost" style="width: 100%" value="<%=editProduct.getCost()%>" onchange="if (this.value.match(/^[1-9]+[0-9]*$/) === null) {alert('Cost is not a number'); this.value = ''; }"> <p>
                        Description:
                        <textarea name ="description" rows ="10" cols="80" style="width: 100%"><%=editProduct.getDescription()%></textarea><p> 
                        Select a guitar image(current image: "<%=editProduct.getImage()%>"):<p>
                        <input type ="file" name="upFile"> <p> 
                        <input type ="submit" value="Save">
                        <input type ="reset" value ="Clear">
                    </form>
                </td>
            </tr>
        </table>
    </div>
</div>

    <%}%>

    <%@include file="/footer.jsp" %>